package spring.batch.readDatabase;

import org.springframework.jdbc.core.RowMapper;
import spring.batch.readFile.People;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Author: huhx
 * @Date: 2017-11-02 上午 10:16
 */
public class UserRowMapper implements RowMapper<People> {

    @Override
    public People mapRow(ResultSet rs, int rowNum) throws SQLException {
        People people = new People();
        people.setUsername(rs.getString("user_name"));
        people.setAge(rs.getInt("age"));
        people.setAddress(rs.getString("address"));
        people.setBirthday(rs.getDate("birthday"));
        return people;
    }
}
